package com.sjzsqjy.asdtiang.mysql;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import org.hibernate.annotations.GenericGenerator;

/**
 * HosRole entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "hos_role", catalog = "hospital", uniqueConstraints = @UniqueConstraint(columnNames = "authority"))
public class HosRole implements java.io.Serializable {

	// Fields

	private Long id;
	private Long version;
	private String authority;
	private String description;
	private Set<HosUser> hosUsers = new HashSet<HosUser>(0);

	// Constructors

	/** default constructor */
	public HosRole() {
	}

	/** minimal constructor */
	public HosRole(Long version, String authority, String description) {
		this.version = version;
		this.authority = authority;
		this.description = description;
	}

	/** full constructor */
	public HosRole(Long version, String authority, String description,
			Set<HosUser> hosUsers) {
		this.version = version;
		this.authority = authority;
		this.description = description;
		this.hosUsers = hosUsers;
	}

	// Property accessors
	@GenericGenerator(name = "generator", strategy = "uuid")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "id", unique = true, nullable = false)
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Column(name = "version", nullable = false)
	public Long getVersion() {
		return this.version;
	}

	public void setVersion(Long version) {
		this.version = version;
	}

	@Column(name = "authority", unique = true, nullable = false)
	public String getAuthority() {
		return this.authority;
	}

	public void setAuthority(String authority) {
		this.authority = authority;
	}

	@Column(name = "description", nullable = false)
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "hosRoles")
	public Set<HosUser> getHosUsers() {
		return this.hosUsers;
	}

	public void setHosUsers(Set<HosUser> hosUsers) {
		this.hosUsers = hosUsers;
	}

}